<template>
  <div>
    <div class="goods-info" @click="goGoodsPage()">
      <div class="goods-image">
          <img v-lazy="goodsImage"/>
      </div>
      <div class="goods-name">{{goodsName}}</div>
      <div class="goods-price">￥{{goodsPrice | moneyFilter }}</div>
    </div>
  </div>
</template>

<script>
import { toMoney } from 'components/filter/filter'
export default {
  data () {
    return {
    }
  },
  props: ['goodsImage', 'goodsName', 'goodsPrice', 'goodsId'],
  filters: {
    moneyFilter (money) {
      return toMoney(money)
    }
  },
  methods: {
    goGoodsPage () {
      this.$router.push({name: 'Goods', params: { id: this.goodsId }})
    }
  }
}
</script>

<style scoped>
.goods-name{
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space:nowrap;
}
.goods-image {
  padding: .3rem;
}
</style>
